function toBusi(obj){
     var busiId = $(obj).attr('busiId');
     window.location.href = 'busi/loadBusiConfig?busiId='+ busiId
}

function login(obj){
   clearError();
   var param = $('#loginForm').serialize();
    $.ajax({
        type : "POST",
        url : "/login",
        data : param,
        dataType:'json',
        success : function(result) {
           if(result.success){
              window.location.href = '/loadMain';
           }else{
               showError(result.msg);
           }
        },
        error : function(e){
            console.log(e.status);
            console.log(e.responseText);
        }
    });
}

function showError(msg){
    $('#error').addClass('error').text(msg);
}

function clearError(){
    $('#error').removeClass('error').text('');
}

function changeGradeValue(gradeObj){
   var that = $(gradeObj);
   var url = 'busi/loadConfigByTypeAndTitle';
   var param = {"likeTitle":that.val(),"type":"class"};
   $.post(url,param,function(result){
        var data = result.data;
        if(result.success){
         $('#className').empty()
         $.each(data,function(i,obj){
            var option = $('<option value='+ obj.value +'>'+ obj.value +'</option>');
            $('#className').append(option);
         });
        }
   },'json');
}